<template>
  <div class="ichangan" ref="ichangan">
    <div class="i-text">
      <div>
        <p>自移动办公至今，我们一共经历了</p>
        <p>
          <span> <count-up :end-val="props.stats?.ichangan?.update" /> </span>次系统版本迭代
        </p>
        <p>
          <span> <count-up :end-val="props.stats?.ichangan?.app" /> </span>个功能上线
        </p>
      </div>
      <div>
        <p>春去秋来</p>
        <p>
          我们为<span>
            <count-up :end-val="props.stats?.ichangan?.user" /> </span>位用户
        </p>
        <p>
          提供了<span>
            <count-up :end-val="props.stats?.ichangan?.service" /> </span>次服务
        </p>
      </div>
      <div>
        <p>平均每日</p>
        <p>
          <span> <count-up :end-val="props.stats?.ichangan?.logPerDay" /> </span>次登录
        </p>
        <p>
          <span>
            <count-up :end-val="props.stats?.ichangan?.meetingPerDay" /> </span>次线上会议召开
        </p>
        <p>
          <span>
            <count-up :end-val="props.stats?.ichangan?.approvalPerDay" /> </span>个流程运转
        </p>
        <p>
          <span>
            <count-up :end-val="props.stats?.ichangan?.emailPerDay" /> </span>封邮件往来
        </p>
      </div>
    </div>
    <img class="i-bg" src="@/assets/img/ichangan/bg.png" />
  </div>
</template>

<script lang="ts" setup>
import { onMounted, ref } from "vue";
import { slideUp, slideDown } from "../../../../utils/slide";

const props = defineProps({
  stats: Object,
});

const emit = defineEmits(["slideUp", "slideDown"]);

onMounted(() => {
  slideUp(ichangan.value, () => {
    console.log("ichangan");
    emit("slideUp");
  });
  slideDown(ichangan.value, () => {
    emit("slideDown");
  });
});

const ichangan = ref<any>(null);
</script>

<script lang="ts">
import CountUp from "@/components/Countup/index.vue";

export default {
  name: "IchanganPage",
  components: {
    CountUp,
  },
};
</script>

<style lang="scss" scoped>
:deep(.countup-wrap) {
  display: inline;
}

.ichangan {
  @include full-screen-relative;
}

.i-text {
  @include animation-fade-in;
  position: absolute;
  top: $text-top;
  left: $text-left;
  z-index: 999;
  font-size: 30px;
  font-family: ChangAnunitype;
  font-weight: 500;
  color: #ffffff;

  div {
    margin-bottom: 70px;

    p {
      margin-top: 15px;

      &:first-child {
        margin-top: 0;
      }
    }

    span {
      font-size: 48px;
    }
  }
}

.i-bg {
  @include animation-move-up;
  position: fixed;
  bottom: -2px;
  left: -2px;
  height: 916px;
  width: 754px;
}
</style>
